import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class PopupMenuButtonPage extends StatefulWidget {
  @override
  PopupMenuButtonPageState createState() => new PopupMenuButtonPageState();
}

class PopupMenuButtonPageState extends State<PopupMenuButtonPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(''),
      ),
      body: PopupMenuButton(
        tooltip: '按啥按',
        onCanceled: (){
          print('取消');
        },
        onSelected: (value){
          print('选择了:$value');
        },
        itemBuilder: (context) {
          return <PopupMenuEntry>[
            PopupMenuItem(value: '语文', child: Text('语文')),
            PopupMenuItem(value: '数学', child: Text('数学')),
            PopupMenuItem(value: '英语', child: Text('英语')),
            PopupMenuItem(value: '生物', child: Text('生物')),
          ];
        },
      ),
    );
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }
}
